SPOOL create_schema_objects.log

SET SQLBLANKLINES ON
CREATE TABLE MYIMC.ACCOUNTS 
(
  ACCOUNT_ID NUMBER NOT NULL 
, ACCOUNT_NAME VARCHAR2(2000) NOT NULL 
, OPN_ID VARCHAR2(100) 
, ADDRESS_ID NUMBER 
, CREATE_DATE DATE NOT NULL 
, CREATED_BY VARCHAR2(50) NOT NULL 
, UPDATE_DATE DATE 
, UPDATED_BY VARCHAR2(50) 
, CONSTRAINT ACCOUNTS_PK PRIMARY KEY 
  (
    ACCOUNT_ID 
  )
  ENABLE 
);

CREATE TABLE MYIMC.ACTIVITIES 
(
  ACTIVITY_ID NUMBER NOT NULL 
, LINKED_REQUEST_ID NUMBER 
, PRODUCT_LINE_CODE VARCHAR2(100) NOT NULL 
, PRODUCT_CODE VARCHAR2(100) NOT NULL 
, ACTIVITY_TYPE VARCHAR2(100) NOT NULL 
, ACTIVITY_CODE VARCHAR2(100) 
, NOTES VARCHAR2(2000) 
, STATUS VARCHAR2(100) 
, START_DATE DATE 
, END_DATE DATE 
, DELIVERED_BY NUMBER 
, DELIVERED_BY2 NUMBER 
, COUNTRY_CODE VARCHAR2(100) 
, CITY VARCHAR2(100) 
, LINKED_RESOURCE VARCHAR2(2000) 
, CREATE_DATE DATE NOT NULL 
, CREATED_BY VARCHAR2(50) NOT NULL 
, UPDATE_DATE DATE 
, UPDATED_BY VARCHAR2(50) 
, CONSTRAINT WORKSHOPS_PK PRIMARY KEY 
  (
    ACTIVITY_ID 
  )
  USING INDEX 
  (
      CREATE UNIQUE INDEX MYIMC.ACTIVITIES_PK ON MYIMC.ACTIVITIES (ACTIVITY_ID ASC) 
  )
  ENABLE 
);

CREATE TABLE MYIMC.ACTIVITY_REQUESTS 
(
  ACTIVITY_REQUEST_ID NUMBER NOT NULL 
, REQUESTOR_ID NUMBER NOT NULL 
, ACTIVITY_TYPE VARCHAR2(100) NOT NULL 
, ACTIVITY_CODE VARCHAR2(100) 
, JUSTIFICATION VARCHAR2(2000) NOT NULL 
, EXPECTED_START_DATE DATE 
, EXPECTED_END_DATE DATE 
, COUNTRY_CODE VARCHAR2(100) 
, CITY VARCHAR2(100) 
, APPROVAL_NOTES VARCHAR2(2000) 
, REQUEST_STATUS VARCHAR2(100) NOT NULL 
, CREATE_DATE DATE NOT NULL 
, CREATED_BY VARCHAR2(50) NOT NULL 
, UPDATE_DATE DATE 
, UPDATED_BY VARCHAR2(50) 
, CONSTRAINT ACTIVITY_REQUESTS_PK PRIMARY KEY 
  (
    ACTIVITY_REQUEST_ID 
  )
  ENABLE 
);

CREATE TABLE MYIMC.ACT_PARTICIPATIONS 
(
  ACT_PARTICIPATION_ID NUMBER NOT NULL 
, ACTIVITY_ID NUMBER NOT NULL 
, PARTICIPANT_ID NUMBER NOT NULL 
, CONFIRMED CHAR(1 CHAR) 
, ATTENDED CHAR(1 CHAR) 
, ATTACHMENT BLOB 
, CREATE_DATE DATE NOT NULL 
, CREATED_BY VARCHAR2(50) NOT NULL 
, UPDATE_DATE DATE 
, UPDATED_BY VARCHAR2(50) 
, CONSTRAINT ACT_PARTICIPATION_PK PRIMARY KEY 
  (
    ACT_PARTICIPATION_ID 
  )
  ENABLE 
);

PROMPT create table 'ADDRESSES'
CREATE TABLE MYIMC.ADDRESSES 
(
  ADDRESS_ID NUMBER NOT NULL 
, COUNTRY_CODE VARCHAR2(100) NOT NULL 
, CITY VARCHAR2(2000) 
, ADDRESS_LINE1 VARCHAR2(2000) 
, ADDRESS_LINE2 VARCHAR2(2000) 
, ADDRESS_LINE3 VARCHAR2(2000) 
, ZIP VARCHAR2(20) 
, CREATE_DATE DATE NOT NULL 
, CREATED_BY VARCHAR2(50) NOT NULL 
, UPDATE_DATE DATE 
, UPDATED_BY VARCHAR2(50) 
, CONSTRAINT ADDRESSES_PK PRIMARY KEY 
  (
    ADDRESS_ID 
  )
  ENABLE 
);

CREATE TABLE MYIMC.CONTACTS 
(
  CONTACT_ID NUMBER NOT NULL 
, LAST_NAME VARCHAR2(200) NOT NULL 
, FIRST_NAME VARCHAR2(200) NOT NULL 
, ACCOUNT_ID NUMBER NOT NULL 
, WORK_EMAIL VARCHAR2(100) 
, WORK_PHONE VARCHAR2(100) 
, MOBILE_PHONE VARCHAR2(100) 
, JOB_TITLE VARCHAR2(200) 
, NOTES VARCHAR2(2000) 
, CREATE_DATE DATE NOT NULL 
, CREATED_BY VARCHAR2(50) NOT NULL 
, UPDATE_DATE DATE 
, UPDATED_BY VARCHAR2(50) 
, CONSTRAINT CONTACTS_PK PRIMARY KEY 
  (
    CONTACT_ID 
  )
  ENABLE 
);

CREATE TABLE MYIMC.EMPLOYEES 
(
  EMPLOYEE_ID NUMBER NOT NULL 
, FIRST_NAME VARCHAR2(200) NOT NULL 
, LAST_NAME VARCHAR2(200) NOT NULL 
, EMAIL VARCHAR2(200) NOT NULL 
, JOB_CODE VARCHAR2(100) 
, MANAGER_ID NUMBER 
, PHOTO BLOB 
, CREATE_DATE DATE NOT NULL 
, CREATED_BY VARCHAR2(50) NOT NULL 
, LAST_UPDATE_DATE DATE 
, UPDATED_BY VARCHAR2(50) 
, CONSTRAINT EMPLOYEES_PK PRIMARY KEY 
  (
    EMPLOYEE_ID 
  )
  ENABLE 
);

CREATE TABLE MYIMC.LOOKUP_TYPES 
(
  CODE VARCHAR2(100) NOT NULL 
, NAME VARCHAR2(2000) NOT NULL 
, PARENT_CODE VARCHAR2(100) 
, CONSTRAINT LOOKUP_TYPES_PK PRIMARY KEY 
  (
    CODE 
  )
  ENABLE 
);

CREATE TABLE MYIMC.LOOKUP_VALUES 
(
  LOOKUP_TYPE_CODE VARCHAR2(100) NOT NULL 
, LOOKUP_VALUE_CODE VARCHAR2(100) NOT NULL 
, VALUE_TEXT VARCHAR2(2000) NOT NULL 
, PARENT_LOOKUP_TYPE_CODE VARCHAR2(100) 
, PARENT_LOOKUP_VALUE_CODE VARCHAR2(100) 
, CONSTRAINT LOOKUP_VALUES_PK PRIMARY KEY 
  (
    LOOKUP_TYPE_CODE 
  , LOOKUP_VALUE_CODE 
  )
  ENABLE 
);

PROMPT create table 'MIGRATIONS'
CREATE TABLE MYIMC.MIGRATIONS 
(
  MIGRATION_ID NUMBER NOT NULL 
, SOLUTION_ID NUMBER NOT NULL 
, RESP_EMPLOYEE_ID NUMBER NOT NULL 
, TYPE VARCHAR2(100) 
, STATUS VARCHAR2(100) 
, START_DATE DATE 
, EXPECTED_END_DATE DATE 
, END_DATE DATE 
, CREATE_DATE DATE NOT NULL 
, CREATED_BY VARCHAR2(50) NOT NULL 
, UPDATE_DATE DATE 
, UPDATED_BY VARCHAR2(50) 
, CONSTRAINT MIGRATIONS_PK PRIMARY KEY 
  (
    MIGRATION_ID 
  )
  ENABLE 
);

PROMPT create table 'ROLE_ASSIGNMENTS'
CREATE TABLE MYIMC.ROLE_ASSIGNMENTS 
(
  ROLE_ASSIGNMENT_ID NUMBER NOT NULL 
, USER_ID NUMBER 
, ROLE_CODE VARCHAR2(100) 
, CREATE_DATE DATE NOT NULL 
, CREATED_BY VARCHAR2(50) NOT NULL 
, UPDATE_DATE DATE 
, UPDATED_BY VARCHAR2(50) 
, CONSTRAINT ROLE_ASSIGNMENTS_PK PRIMARY KEY 
  (
    ROLE_ASSIGNMENT_ID 
  )
  ENABLE 
);

PROMPT create table 'SOLUTIONS'
CREATE TABLE MYIMC.SOLUTIONS 
(
  SOLUTION_ID NUMBER NOT NULL 
, NAME VARCHAR2(500) NOT NULL 
, DESCRIPTION VARCHAR2(2000) 
, ACCOUNT_ID NUMBER NOT NULL 
, INDUSTRY_CODE VARCHAR2(100) 
, SOLUTION_TYPE_CODE VARCHAR2(100) 
, CREATE_DATE DATE NOT NULL 
, CREATED_BY VARCHAR2(50) NOT NULL 
, UPDATE_DATE DATE 
, UPDATED_BY VARCHAR2(50) 
, CONSTRAINT SOLUTIONS_PK PRIMARY KEY 
  (
    SOLUTION_ID 
  )
  ENABLE 
);

CREATE TABLE MYIMC.SOLUTION_TECHS 
(
  SOLUTION_TECH_ID NUMBER NOT NULL 
, SOLUTION_ID NUMBER NOT NULL 
, TECH_TYPE_CODE VARCHAR2(100) NOT NULL 
, TECH_VALUE_CODE VARCHAR2(100) NOT NULL 
, CONSTRAINT SOLUTION_TECHS_PK PRIMARY KEY 
  (
    SOLUTION_TECH_ID 
  )
  ENABLE 
);

CREATE TABLE MYIMC.USERS 
(
  USER_ID NUMBER NOT NULL 
, USERNAME VARCHAR2(100) NOT NULL 
, PASSWORD VARCHAR2(100) NOT NULL 
, STATUS VARCHAR2(100) 
, EMPLOYEE_ID NUMBER NOT NULL 
, CREATE_DATE DATE NOT NULL 
, CREATED_BY VARCHAR2(50) NOT NULL 
, UPDATE_DATE DATE 
, UPDATED_BY VARCHAR2(50) 
, CONSTRAINT USERS_PK PRIMARY KEY 
  (
    USER_ID 
  )
  ENABLE 
);

PROMPT create index 'ACCOUNTS_I1'
CREATE INDEX MYIMC.ACCOUNTS_I1 ON MYIMC.ACCOUNTS (ACCOUNT_NAME);

PROMPT create index 'ACTIVITIES_I1'
CREATE INDEX MYIMC.ACTIVITIES_I1 ON MYIMC.ACTIVITIES (LINKED_REQUEST_ID);

PROMPT create index 'ACTIVITIES_I2'
CREATE INDEX MYIMC.ACTIVITIES_I2 ON MYIMC.ACTIVITIES (DELIVERED_BY);

PROMPT create index 'ACTIVITIES_I3'
CREATE INDEX MYIMC.ACTIVITIES_I3 ON MYIMC.ACTIVITIES (DELIVERED_BY2);

PROMPT create index 'ACTIVITY_REQUESTS_I1'
CREATE INDEX MYIMC.ACTIVITY_REQUESTS_I1 ON MYIMC.ACTIVITY_REQUESTS (REQUESTOR_ID);

PROMPT create index 'ACT_PARTICIPATIONS_I1'
CREATE INDEX MYIMC.ACT_PARTICIPATIONS_I1 ON MYIMC.ACT_PARTICIPATIONS (PARTICIPANT_ID, ACTIVITY_ID);

PROMPT create index 'CONTACTS_I1'
CREATE INDEX MYIMC.CONTACTS_I1 ON MYIMC.CONTACTS (ACCOUNT_ID);

PROMPT create index 'EMPLOYEES_I1'
CREATE INDEX MYIMC.EMPLOYEES_I1 ON MYIMC.EMPLOYEES (MANAGER_ID);

PROMPT create index 'LOOKUP_TYPES_I1'
CREATE INDEX MYIMC.LOOKUP_TYPES_I1 ON MYIMC.LOOKUP_TYPES (PARENT_CODE);

PROMPT create index 'LOOKUP_VALUES_I1'
CREATE INDEX MYIMC.LOOKUP_VALUES_I1 ON MYIMC.LOOKUP_VALUES (PARENT_LOOKUP_VALUE_CODE);

PROMPT create index 'SOLUTION_TECHS_I1'
CREATE INDEX MYIMC.SOLUTION_TECHS_I1 ON MYIMC.SOLUTION_TECHS (SOLUTION_ID, TECH_TYPE_CODE);

PROMPT create index 'USERS_I1'
CREATE INDEX MYIMC.USERS_I1 ON MYIMC.USERS (EMPLOYEE_ID);

ALTER TABLE MYIMC.ACCOUNTS
ADD CONSTRAINT ACCOUNTS_UK1 UNIQUE 
(
  OPN_ID 
)
ENABLE;

ALTER TABLE MYIMC.ACT_PARTICIPATIONS
ADD CONSTRAINT ACT_PARTICIPATIONS_UK1 UNIQUE 
(
  ACTIVITY_ID 
, PARTICIPANT_ID 
)
ENABLE;

ALTER TABLE MYIMC.CONTACTS
ADD CONSTRAINT CONTACTS_UK1 UNIQUE 
(
  WORK_EMAIL 
)
ENABLE;

ALTER TABLE MYIMC.EMPLOYEES
ADD CONSTRAINT EMPLOYEES_UK1 UNIQUE 
(
  EMAIL 
)
ENABLE;

PROMPT alter table 'MIGRATIONS'
ALTER TABLE MYIMC.MIGRATIONS
ADD CONSTRAINT MIGRATIONS_UK1 UNIQUE 
(
  SOLUTION_ID 
, TYPE 
, START_DATE 
)
ENABLE;

PROMPT alter table 'ROLE_ASSIGNMENTS'
ALTER TABLE MYIMC.ROLE_ASSIGNMENTS
ADD CONSTRAINT ROLE_ASSIGNMENTS_UK1 UNIQUE 
(
  USER_ID 
, ROLE_CODE 
)
ENABLE;

PROMPT alter table 'SOLUTIONS'
ALTER TABLE MYIMC.SOLUTIONS
ADD CONSTRAINT SOLUTIONS_UK1 UNIQUE 
(
  ACCOUNT_ID 
, NAME 
)
ENABLE;

ALTER TABLE MYIMC.ACCOUNTS
ADD CONSTRAINT ACCOUNTS_FK1 FOREIGN KEY
(
  ADDRESS_ID 
)
REFERENCES MYIMC.ADDRESSES
(
  ADDRESS_ID 
)
ENABLE;

ALTER TABLE MYIMC.ACTIVITIES
ADD CONSTRAINT ACTIVITIES_FK1 FOREIGN KEY
(
  LINKED_REQUEST_ID 
)
REFERENCES MYIMC.ACTIVITY_REQUESTS
(
  ACTIVITY_REQUEST_ID 
)
ENABLE;

ALTER TABLE MYIMC.ACTIVITIES
ADD CONSTRAINT ACTIVITIES_FK2 FOREIGN KEY
(
  DELIVERED_BY 
)
REFERENCES MYIMC.EMPLOYEES
(
  EMPLOYEE_ID 
)
ENABLE;

ALTER TABLE MYIMC.ACTIVITIES
ADD CONSTRAINT ACTIVITIES_FK3 FOREIGN KEY
(
  DELIVERED_BY2 
)
REFERENCES MYIMC.EMPLOYEES
(
  EMPLOYEE_ID 
)
ENABLE;

ALTER TABLE MYIMC.ACTIVITY_REQUESTS
ADD CONSTRAINT ACTIVITY_REQUESTS_FK1 FOREIGN KEY
(
  REQUESTOR_ID 
)
REFERENCES MYIMC.EMPLOYEES
(
  EMPLOYEE_ID 
)
ENABLE;

ALTER TABLE MYIMC.ACT_PARTICIPATIONS
ADD CONSTRAINT EVENT_PARTICIPATION_FK1 FOREIGN KEY
(
  ACTIVITY_ID 
)
REFERENCES MYIMC.ACTIVITIES
(
  ACTIVITY_ID 
)
ENABLE;

ALTER TABLE MYIMC.ACT_PARTICIPATIONS
ADD CONSTRAINT EVENT_PARTICIPATION_FK2 FOREIGN KEY
(
  PARTICIPANT_ID 
)
REFERENCES MYIMC.CONTACTS
(
  CONTACT_ID 
)
ENABLE;

ALTER TABLE MYIMC.CONTACTS
ADD CONSTRAINT CONTACTS_FK1 FOREIGN KEY
(
  ACCOUNT_ID 
)
REFERENCES MYIMC.ACCOUNTS
(
  ACCOUNT_ID 
)
ENABLE;

ALTER TABLE MYIMC.EMPLOYEES
ADD CONSTRAINT EMPLOYEES_FK1 FOREIGN KEY
(
  MANAGER_ID 
)
REFERENCES MYIMC.EMPLOYEES
(
  EMPLOYEE_ID 
)
ENABLE;

ALTER TABLE MYIMC.LOOKUP_TYPES
ADD CONSTRAINT LOOKUP_TYPES_FK1 FOREIGN KEY
(
  PARENT_CODE 
)
REFERENCES MYIMC.LOOKUP_TYPES
(
  CODE 
)
ENABLE;

ALTER TABLE MYIMC.LOOKUP_VALUES
ADD CONSTRAINT LOOKUP_VALUES_FK1 FOREIGN KEY
(
  LOOKUP_TYPE_CODE 
)
REFERENCES MYIMC.LOOKUP_TYPES
(
  CODE 
)
ENABLE;

ALTER TABLE MYIMC.LOOKUP_VALUES
ADD CONSTRAINT LOOKUP_VALUES_FK2 FOREIGN KEY
(
  PARENT_LOOKUP_TYPE_CODE 
, PARENT_LOOKUP_VALUE_CODE 
)
REFERENCES MYIMC.LOOKUP_VALUES
(
  LOOKUP_TYPE_CODE 
, LOOKUP_VALUE_CODE 
)
ENABLE;

PROMPT alter table 'MIGRATIONS'
ALTER TABLE MYIMC.MIGRATIONS
ADD CONSTRAINT MIGRATIONS_FK1 FOREIGN KEY
(
  RESP_EMPLOYEE_ID 
)
REFERENCES MYIMC.EMPLOYEES
(
  EMPLOYEE_ID 
)
ENABLE;

PROMPT alter table 'MIGRATIONS'
ALTER TABLE MYIMC.MIGRATIONS
ADD CONSTRAINT MIGRATIONS_FK2 FOREIGN KEY
(
  SOLUTION_ID 
)
REFERENCES MYIMC.SOLUTIONS
(
  SOLUTION_ID 
)
ENABLE;

PROMPT alter table 'ROLE_ASSIGNMENTS'
ALTER TABLE MYIMC.ROLE_ASSIGNMENTS
ADD CONSTRAINT ROLE_ASSIGNMENTS_FK1 FOREIGN KEY
(
  USER_ID 
)
REFERENCES MYIMC.USERS
(
  USER_ID 
)
ENABLE;

PROMPT alter table 'SOLUTIONS'
ALTER TABLE MYIMC.SOLUTIONS
ADD CONSTRAINT SOLUTIONS_FK1 FOREIGN KEY
(
  ACCOUNT_ID 
)
REFERENCES MYIMC.ACCOUNTS
(
  ACCOUNT_ID 
)
ENABLE;

ALTER TABLE MYIMC.SOLUTION_TECHS
ADD CONSTRAINT SOLUTION_TECHS_FK1 FOREIGN KEY
(
  SOLUTION_ID 
)
REFERENCES MYIMC.SOLUTIONS
(
  SOLUTION_ID 
)
ENABLE;

ALTER TABLE MYIMC.USERS
ADD CONSTRAINT USERS_FK1 FOREIGN KEY
(
  EMPLOYEE_ID 
)
REFERENCES MYIMC.EMPLOYEES
(
  EMPLOYEE_ID 
)
ENABLE;

COMMENT ON COLUMN MYIMC.ACTIVITIES.PRODUCT_LINE_CODE IS 'FMW, DBO, etc';

COMMENT ON COLUMN MYIMC.ACTIVITIES.PRODUCT_CODE IS 'Weblogic, ADF, etc';

COMMENT ON COLUMN MYIMC.ACTIVITIES.ACTIVITY_TYPE IS 'webinar, workshop, etc';

COMMENT ON COLUMN MYIMC.ACTIVITIES.ACTIVITY_CODE IS 'code of the webinar, workshop (from the lookup)';

COMMENT ON COLUMN MYIMC.ACTIVITIES.STATUS IS 'Workshop status code';

COMMENT ON COLUMN MYIMC.ACTIVITIES.DELIVERED_BY IS 'The employee who delivers this activity';

COMMENT ON COLUMN MYIMC.ACTIVITIES.DELIVERED_BY2 IS 'The second employee who delivers this activity';

COMMENT ON COLUMN MYIMC.ACTIVITIES.LINKED_RESOURCE IS 'For example, the URL of the webinar recording';

COMMENT ON COLUMN MYIMC.ACTIVITY_REQUESTS.REQUESTOR_ID IS 'Employee who requested to deliver this activity';

COMMENT ON COLUMN MYIMC.ACTIVITY_REQUESTS.ACTIVITY_TYPE IS 'What kind of activity should be delivered: webinar, workshop, etc...';

COMMENT ON COLUMN MYIMC.ACTIVITY_REQUESTS.ACTIVITY_CODE IS 'code of the workshop from the lookup';

COMMENT ON COLUMN MYIMC.ACTIVITY_REQUESTS.EXPECTED_START_DATE IS 'Expected start date of the activity';

COMMENT ON COLUMN MYIMC.ACTIVITY_REQUESTS.EXPECTED_END_DATE IS 'Expected end date of the activity';

COMMENT ON COLUMN MYIMC.ACTIVITY_REQUESTS.COUNTRY_CODE IS 'The country which the activity should be organized in.';

COMMENT ON COLUMN MYIMC.ACTIVITY_REQUESTS.CITY IS 'The city which the activity should be organized in.';

COMMENT ON COLUMN MYIMC.ACT_PARTICIPATIONS.CONFIRMED IS 'Indicates if we confirmed the participataion for this person or not.';

COMMENT ON COLUMN MYIMC.ACT_PARTICIPATIONS.ATTENDED IS 'Indicates if the participant attended the event.';

COMMENT ON COLUMN MYIMC.ACT_PARTICIPATIONS.ATTACHMENT IS 'Can be used to attached pdf feedback forms  for the workshops';

COMMENT ON COLUMN MYIMC.LOOKUP_TYPES.CODE IS 'Lookup code';

COMMENT ON COLUMN MYIMC.LOOKUP_TYPES.NAME IS 'Lookup name';

COMMENT ON COLUMN MYIMC.LOOKUP_TYPES.PARENT_CODE IS 'Code of the parent lookup';

COMMENT ON COLUMN MYIMC.LOOKUP_VALUES.LOOKUP_TYPE_CODE IS '';

COMMENT ON COLUMN MYIMC.LOOKUP_VALUES.PARENT_LOOKUP_TYPE_CODE IS 'Code of the parent lookup type (for the hierarchical lookups)';

COMMENT ON COLUMN MYIMC.LOOKUP_VALUES.PARENT_LOOKUP_VALUE_CODE IS 'Code of the parent lookup value (for the hierarchical lookups)';

COMMENT ON COLUMN MYIMC.MIGRATIONS.SOLUTION_ID IS 'Partner''s solution';

COMMENT ON COLUMN MYIMC.MIGRATIONS.RESP_EMPLOYEE_ID IS 'Employee responsible for the migration/adoption';

COMMENT ON COLUMN MYIMC.MIGRATIONS.TYPE IS 'Migration/adoption type code';

COMMENT ON COLUMN MYIMC.MIGRATIONS.STATUS IS 'Migration/adoption status code';

COMMENT ON COLUMN MYIMC.ROLE_ASSIGNMENTS.ROLE_CODE IS 'roles are defined in the lookups';

COMMENT ON COLUMN MYIMC.SOLUTIONS.SOLUTION_TYPE_CODE IS 'Named accout, TGB, etc..';

COMMENT ON COLUMN MYIMC.SOLUTION_TECHS.SOLUTION_TECH_ID IS 'Details about partner solutions';

COMMENT ON COLUMN MYIMC.SOLUTION_TECHS.TECH_TYPE_CODE IS 'DB, OS, APP_SERVER or other technology type that''s used in the solution';

COMMENT ON COLUMN MYIMC.SOLUTION_TECHS.TECH_VALUE_CODE IS 'MSSQL as a DB, Weblogic as a APP_SERVER, etc';

PROMPT create sequence 'ACCOUNTS_SEQ'
CREATE SEQUENCE MYIMC.ACCOUNTS_SEQ;

PROMPT create sequence 'ACTIVITIES_SEQ'
CREATE SEQUENCE MYIMC.ACTIVITIES_SEQ NOCACHE;

PROMPT create sequence 'ACTIVITY_REQUESTS_SEQ'
CREATE SEQUENCE MYIMC.ACTIVITY_REQUESTS_SEQ;

PROMPT create sequence 'ACT_PARTICIPATION_SEQ'
CREATE SEQUENCE MYIMC.ACT_PARTICIPATION_SEQ;

PROMPT create sequence 'ADDRESSES_SEQ'
CREATE SEQUENCE MYIMC.ADDRESSES_SEQ;

PROMPT create sequence 'CONTACTS_SEQ'
CREATE SEQUENCE MYIMC.CONTACTS_SEQ;

PROMPT create sequence 'EMPLOYEES_SEQ'
CREATE SEQUENCE MYIMC.EMPLOYEES_SEQ;

PROMPT create sequence 'MIGRATIONS_SEQ'
CREATE SEQUENCE MYIMC.MIGRATIONS_SEQ;

PROMPT create sequence 'ROLE_ASSIGNMENTS_SEQ'
CREATE SEQUENCE MYIMC.ROLE_ASSIGNMENTS_SEQ;

PROMPT create sequence 'SOLUTIONS_SEQ'
CREATE SEQUENCE MYIMC.SOLUTIONS_SEQ;

PROMPT create sequence 'SOLUTION_TECHS_SEQ'
CREATE SEQUENCE MYIMC.SOLUTION_TECHS_SEQ;

PROMPT create sequence 'USERS_SEQ'
CREATE SEQUENCE MYIMC.USERS_SEQ;

PROMPT create trigger 'ACCOUNTS_TRG'
CREATE TRIGGER MYIMC.ACCOUNTS_TRG 
BEFORE INSERT ON "MYIMC".ACCOUNTS 
FOR EACH ROW 
BEGIN
  <<COLUMN_SEQUENCES>>
  BEGIN
    IF :NEW.ACCOUNT_ID IS NULL THEN
      SELECT ACCOUNTS_SEQ.NEXTVAL INTO :NEW.ACCOUNT_ID FROM DUAL;
    END IF;
  END COLUMN_SEQUENCES;
END;
/

PROMPT create trigger 'ACTIVITIES_TRG'
CREATE TRIGGER MYIMC.ACTIVITIES_TRG 
BEFORE INSERT ON "MYIMC".ACTIVITIES 
FOR EACH ROW 
BEGIN
  <<COLUMN_SEQUENCES>>
  BEGIN
    IF :NEW.ACTIVITY_ID IS NULL THEN
      SELECT ACTIVITIES_SEQ.NEXTVAL INTO :NEW.ACTIVITY_ID FROM DUAL;
    END IF;
  END COLUMN_SEQUENCES;
END;
/

PROMPT create trigger 'ACTIVITY_REQUESTS_TRG'
CREATE TRIGGER MYIMC.ACTIVITY_REQUESTS_TRG 
BEFORE INSERT ON "MYIMC".ACTIVITY_REQUESTS 
FOR EACH ROW 
BEGIN
  <<COLUMN_SEQUENCES>>
  BEGIN
    IF :NEW.ACTIVITY_REQUEST_ID IS NULL THEN
      SELECT ACTIVITY_REQUESTS_SEQ.NEXTVAL INTO :NEW.ACTIVITY_REQUEST_ID FROM DUAL;
    END IF;
  END COLUMN_SEQUENCES;
END;
/

PROMPT create trigger 'ACT_PARTICIPATION_TRG'
CREATE TRIGGER MYIMC.ACT_PARTICIPATION_TRG 
BEFORE INSERT ON "MYIMC".ACT_PARTICIPATIONS 
FOR EACH ROW 
BEGIN
  <<COLUMN_SEQUENCES>>
  BEGIN
    IF :NEW.ACT_PARTICIPATION_ID IS NULL THEN
      SELECT ACT_PARTICIPATION_SEQ.NEXTVAL INTO :NEW.ACT_PARTICIPATION_ID FROM DUAL;
    END IF;
  END COLUMN_SEQUENCES;
END;
/

PROMPT create trigger 'ADDRESSES_TRG'
CREATE TRIGGER MYIMC.ADDRESSES_TRG 
BEFORE INSERT ON "MYIMC".ADDRESSES 
FOR EACH ROW 
BEGIN
  <<COLUMN_SEQUENCES>>
  BEGIN
    IF :NEW.ADDRESS_ID IS NULL THEN
      SELECT ADDRESSES_SEQ.NEXTVAL INTO :NEW.ADDRESS_ID FROM DUAL;
    END IF;
  END COLUMN_SEQUENCES;
END;
/

PROMPT create trigger 'CONTACTS_TRG'
CREATE TRIGGER MYIMC.CONTACTS_TRG 
BEFORE INSERT ON "MYIMC".CONTACTS 
FOR EACH ROW 
BEGIN
  <<COLUMN_SEQUENCES>>
  BEGIN
    IF :NEW.CONTACT_ID IS NULL THEN
      SELECT CONTACTS_SEQ.NEXTVAL INTO :NEW.CONTACT_ID FROM DUAL;
    END IF;
  END COLUMN_SEQUENCES;
END;
/

PROMPT create trigger 'EMPLOYEES_TRG'
CREATE TRIGGER MYIMC.EMPLOYEES_TRG 
BEFORE INSERT ON "MYIMC".EMPLOYEES 
FOR EACH ROW 
BEGIN
  <<COLUMN_SEQUENCES>>
  BEGIN
    IF :NEW.EMPLOYEE_ID IS NULL THEN
      SELECT EMPLOYEES_SEQ.NEXTVAL INTO :NEW.EMPLOYEE_ID FROM DUAL;
    END IF;
  END COLUMN_SEQUENCES;
END;
/

PROMPT create trigger 'MIGRATIONS_TRG'
CREATE TRIGGER MYIMC.MIGRATIONS_TRG 
BEFORE INSERT ON "MYIMC".MIGRATIONS 
FOR EACH ROW 
BEGIN
  <<COLUMN_SEQUENCES>>
  BEGIN
    IF :NEW.MIGRATION_ID IS NULL THEN
      SELECT MIGRATIONS_SEQ.NEXTVAL INTO :NEW.MIGRATION_ID FROM DUAL;
    END IF;
  END COLUMN_SEQUENCES;
END;
/

PROMPT create trigger 'ROLE_ASSIGNMENTS_TRG'
CREATE TRIGGER MYIMC.ROLE_ASSIGNMENTS_TRG 
BEFORE INSERT ON "MYIMC".ROLE_ASSIGNMENTS 
FOR EACH ROW 
BEGIN
  <<COLUMN_SEQUENCES>>
  BEGIN
    IF :NEW.ROLE_ASSIGNMENT_ID IS NULL THEN
      SELECT ROLE_ASSIGNMENTS_SEQ.NEXTVAL INTO :NEW.ROLE_ASSIGNMENT_ID FROM DUAL;
    END IF;
  END COLUMN_SEQUENCES;
END;
/

PROMPT create trigger 'SOLUTIONS_TRG'
CREATE TRIGGER MYIMC.SOLUTIONS_TRG 
BEFORE INSERT ON "MYIMC".SOLUTIONS 
FOR EACH ROW 
BEGIN
  <<COLUMN_SEQUENCES>>
  BEGIN
    IF :NEW.SOLUTION_ID IS NULL THEN
      SELECT SOLUTIONS_SEQ.NEXTVAL INTO :NEW.SOLUTION_ID FROM DUAL;
    END IF;
  END COLUMN_SEQUENCES;
END;
/

PROMPT create trigger 'SOLUTION_TECHS_TRG'
CREATE TRIGGER MYIMC.SOLUTION_TECHS_TRG 
BEFORE INSERT ON "MYIMC".SOLUTION_TECHS 
FOR EACH ROW 
BEGIN
  <<COLUMN_SEQUENCES>>
  BEGIN
    IF :NEW.SOLUTION_TECH_ID IS NULL THEN
      SELECT SOLUTION_TECHS_SEQ.NEXTVAL INTO :NEW.SOLUTION_TECH_ID FROM DUAL;
    END IF;
  END COLUMN_SEQUENCES;
END;
/

PROMPT create trigger 'USERS_TRG'
CREATE TRIGGER MYIMC.USERS_TRG 
BEFORE INSERT ON "MYIMC".USERS 
FOR EACH ROW 
BEGIN
  <<COLUMN_SEQUENCES>>
  BEGIN
    IF :NEW.USER_ID IS NULL THEN
      SELECT USERS_SEQ.NEXTVAL INTO :NEW.USER_ID FROM DUAL;
    END IF;
  END COLUMN_SEQUENCES;
END;
/

SPOOL OFF